<template>
    <div class="game-card-10000">
        <div class="item-nav" v-if="detail.label">
            <div class="nav-left"></div>
            <div class="nav-center">{{detail.label}}</div>
        </div>
        <div class="box">
            <div class="item-box" :style="{'width': detail.gameList.length * 192 + 'px'}">
                <div class="item" v-for="(item, index) in detail.gameList" :key="index">
                    <div class="item-icon">
                        <img :src="item.cover" alt="">
                        <div class="love-box">
                            <div class="love-icon"></div>
                            <div class="love-num">{{item.thumbsNum || 0}}</div>
                        </div>
                    </div>
                    <div class="item-title">{{item.title}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'model10000',
    props: ['data'],
    data () {
        return {
            detail: {
                label: '',
                gameList: [
                    {
                        cover: '',
                        title: '',
                        author: {
                            userIcon: '',
                            nickname: ''
                        }
                    },
                    {
                        cover: '',
                        title: '',
                        author: {
                            userIcon: '',
                            nickname: ''
                        }
                    },
                    {
                        cover: '',
                        title: '',
                        author: {
                            userIcon: '',
                            nickname: ''
                        }
                    }
                ]
            }
        }
    },
    created () {
        if (this.data) {
            this.detail.label = this.data.label
        }
        if (this.data && this.data.gameList && this.data.gameList.length) {
            this.detail = this.data
        }
    },
    watch: {
        data: {
            handler: function (val) {
                if (val) {
                    this.detail.label = val.label
                }
                if (val && val.gameList && val.gameList.length) {
                    this.detail = val
                }
            },
            deep: true
        }
    }
}
</script>

<style lang="scss">
    .game-card-10000 {
        padding: 18px 0px 20px;
        border-bottom: 1px solid rgba(228,228,228,1);
        .item-nav {
            display: flex;
            height: 16px;
            align-items: center;
            padding: 0 16px;
            margin-bottom: 12px;
            .nav-left {
                width:4px;
                height:16px;
                background:rgba(0,191,60,1);
                border-radius:3px;
                margin-right: 8px;
            }
            .nav-center {
                flex: 1;
                font-size:16px;
                font-family:SourceHanSansCN-Medium,SourceHanSansCN;
                font-weight:500;
                color:rgba(28,32,44,1);
            }

        }
        .box {
            padding-left: 16px;
            overflow-x: scroll;
            .item-box {
                display: flex;
                .item {
                    width: 176px;
                    margin-right: 16px;
                    .item-icon {
                        position: relative;
                        width:176px;
                        height:176px;
                        border-radius:8px;
                        overflow: hidden;
                        background-color: #ddd;
                        > img {
                            width: 100%;
                            height: 100%;
                        }
                        .love-box {
                            position: absolute;
                            bottom: 6px;
                            right: 8px;
                            z-index: inherit;
                            display: flex;
                            align-items: center;
                            .love-icon {
                                width: 10px;
                                height: 10px;
                                background-size: 100% 100%;
                                background-image: url('./img/hart.png');
                                margin-right: 4px;
                            }
                            .love-num {
                                font-size:12px;
                                font-family:Roboto-Regular,Roboto;
                                font-weight:400;
                                color:rgba(255,255,255,1);
                            }
                        }
                    }
                    .item-title {
                        margin-top: 6px;
                        font-size:14px;
                        font-family:SourceHanSansCN-Regular,SourceHanSansCN;
                        font-weight:400;
                        color:rgba(28,32,44,.8);
                        line-height:20px;
                        height: 42px;
                        overflow: hidden;
                        -webkit-line-clamp: 2;
                        -webkit-box-orient: vertical;
                        display: -webkit-box;
                    }
                }
            }
        }
    }
</style>
